package com.lianzhihui.romeex.adapter;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.ExchangeFindExchangeFlowBean;
import com.lianzhihui.romeex.utils.DateUtil;

import java.util.List;

import butterknife.Setter;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.trade.adapter
 * @ClassName: ExtractFragmentAdapter
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/10/30 17:38
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/10/30 17:38
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class ExchangeRecordFragmentAdapter extends BaseQuickAdapter<ExchangeFindExchangeFlowBean.ContentBean, BaseViewHolder> {

    Context mContext;
    int type;

    public ExchangeRecordFragmentAdapter(@Nullable Context mContext, int type, @Nullable List<ExchangeFindExchangeFlowBean.ContentBean> data) {
        super(R.layout.item_exchange_record_fragment, data);
        this.mContext = mContext;
        this.type = type;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ExchangeFindExchangeFlowBean.ContentBean item) {
        if (type == 1) {
            //1 添加记录
            helper.setText(R.id.timestamp, DateUtil.sec2Date((item.getTimestamp())))
                    .setText(R.id.tv_balance, item.getAmount());
            helper.getView(R.id.tv_address).setVisibility(View.GONE);
        } else {
            //2 消费记录
            helper.setText(R.id.tv_address, item.getWalletAddress())
                    .setText(R.id.tv_balance, item.getAmount())
                    .setText(R.id.timestamp, DateUtil.sec2Date((item.getTimestamp())));
        }

    }
}
